<?php

namespace App\Repository\Redis;

use App\DataStore\RedisAgencyGeneral;
use App\Model\Agency\AgencyCompanyModel;
use App\Repository\Msq\AgencyCompanyMsq;
use App\Repository\RepositoryGeneral;
use Hyperf\Di\Annotation\Inject;

class AgencyCompanyRedis extends RepositoryGeneral
{

    #[Inject]
    public AgencyCompanyMsq $agencyCompanyMsq;

    public function getAgencyCompanySelect() :array{
        $res = RedisAgencyGeneral::getInc()->getAgencySelect(getOrganIdByOrganCode());
        return jsonDecode($res);
    }

    public function updateCompanyCache(){
        // t
        RedisAgencyGeneral::getInc()->setAgencyCompany(getOrganIdByOrganCode(),$this->agencyCompanyMsq->getAgencyCompanySelect());
    }

}